package com.xyoto.community.vo;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.xyoto.community.constant.LoveStatus;
import com.xyoto.community.po.DynamicPicturePO;
import com.xyoto.community.po.UserTitlePO;
import com.xyoto.community.utils.PictureUtils;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.Date;
import java.util.List;

@ApiModel("我的动态列表结果封装")
@Data
public class MyDynamicListVo {

    @ApiModelProperty("自增id")
    private Integer id;

    @ApiModelProperty("话题id")
    private Integer topicId;

    @ApiModelProperty("用户id")
    private Integer userId;

    public void setTopicId(Integer topicId) {
        this.topicId = topicId == null ? 0 : topicId;
    }

    @ApiModelProperty("话题名称")
    private String title;

    @ApiModelProperty("动态内容")
    private String  content;

    @ApiModelProperty("动态图片")
    private List<DynamicPicturePO> dynamicPicturePo;

    @ApiModelProperty("发布时间")
    private Date createTime;

    @ApiModelProperty("昵称")
    private String nickname;

    @ApiModelProperty("头像")
    private String avatarUrl;

    @ApiModelProperty("我的点赞状态")
    private Short loveStatus;

    @ApiModelProperty("关注状态")
    private Short followStatus;

    @ApiModelProperty("动态点赞数目")
    private Integer dynamicLoveCount;

    @ApiModelProperty("动态转发数目")
    private Integer dynamicForwardCount;

    @ApiModelProperty("动态评论数目")
    private Integer dynamicCommentCount;

    @ApiModelProperty("匿名昵称")
    private String anonymousName;

    @ApiModelProperty("匿名头像地址")
    private String anonymousAvatarUrl;

    @ApiModelProperty("动态匿名状态")
    private Integer status;

    public void setStatus(Integer status) {
        this.status = status == null ? 1 : status;
    }

    @ApiModelProperty("是否私密")
    private Boolean personal;

    @ApiModelProperty("发布动态的位置")
    private String dynamicPlace;

    @ApiModelProperty("头衔")
    @JsonProperty("userTitle")
    private UserTitlePO userTitlePO;

    public MyDynamicListVo(){
        this.title = "";
        this.nickname = "";
        this.avatarUrl = null;
        this.dynamicCommentCount = 0;
        this.dynamicForwardCount = 0;
        this.dynamicLoveCount = 0;
        this.loveStatus = LoveStatus.UN_LOVE;
        this.personal = true;
    }

    public void setAvatarUrl(String avatarUrl) {
        this.avatarUrl = PictureUtils.addPrefix(avatarUrl);
    }
}
